﻿namespace Hydra.Payload.Hooking
{
    using System;
    using System.Runtime.InteropServices;
    using Hydra.Payload.Hooking;

    /// <summary>
    /// Sample template classs
    /// </summary>
    class Targets
    {
        [StructLayout(LayoutKind.Sequential)]
        public struct PAYLOAD_LAYOUT
        {
            public int GOOD;
            public int BAD;
            public byte[] BUFFER;
        }

        [HookBehavior(typeof(SimpleHookProc))]
        [DllImport("user32")]
        public static extern int SendMessageW(int hwnd, int msg, int wparam, int lparam);

        [DllImport("user32")]
        public static extern int SendMessageA(int hwnd, int msg, int wparam, int lparam);

        [HookBehavior(typeof(MyHookProc))]
        [DllImport("user32")]
        public static extern int DialogBoxW(int hInstance, [MarshalAs(UnmanagedType.LPWStr)]string lpTemplate, int hWndParent, [MarshalAs(UnmanagedType.FunctionPtr)] int lpDialogFunc);
    }

    class MyHookProc : SimpleHookProc
    {
        public override bool HookPostCall
        {
            get
            {
                return true;
            }
        }

        public override void PostCall(string function, params HyraHookParam[] objs)
        {
            base.PostCall(function, objs);

            //TODO: do something
        }
    }
}
